;(function(){
  var iframecont = document.getElementById('iframe').contentWindow;
  var sdk ={
      getUname: function(){
              var info = Tool.pareUrl(location.href);
              iframecont.postMessage({action: 'getUname', info: 'zhangsan'}, 'b.com');
          },
      sayHi: function(info){
              alert(info.msg);
      },
  };

  //监听接收
  window.addEventListener("message", function(e){
      var res = e;
      var data = e.data;
      var info = e.data.info;
      if(true){
          switch (data.action) {
              case 'sayHi' :
                  sdk.sayHi(info);
                  break;
              case 'getUname' :
                  sdk.getUname();
                  break;
              default :
                  return
          }
      }
  });
})();